<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
  <div id="app">
      <h1>普通价:{{price}}</h1>
      <h1>会员价:{{memberPrice}}</h1>
    </div>

  <script src="../js/vue.js"></script>
  <script>
     // 1.创建Vue的实例对象
     const app = Vue.createApp({
      data(){
        return {
          price: 5,
        }
      },
       // 计算属性
       computed: {
        memberPrice(){
          return this.price * 0.8;
        }
       },
       // 侦听器
       watch: {
        // 侦听到 price 发生变化就会触发这个函数
        price(current,prev){
          // current 现在的值, prev 之前的值
          console.log(current,prev);
          console.log("price发生了变化");
        }
       }
     });

     app.mount('#app');
  </script>
</body>
</html>